#pragma once
#include "IniWrapper.h"

namespace SD_Tools
{
	//************************************
	// Method:    LoadBool
	// Profit:	  Loads a bool from an ini file
	// FullName:  SD_Tools::AbstractIni::LoadBool
	// Returns:   bool
	// Notes:
	// -returns false upon failure
	//************************************
	bool AbstractIni::LoadBool( char* FilePath, char* Section, char* Name, bool* Out )
	{
		char Buffer[256];
		GetPrivateProfileStringA(Section, Name, "ERROR", Buffer, sizeof(Buffer), FilePath);
		if (strcmp(Buffer, "ERROR") == 0)
		{
			return false;
		}
		else
		{
			*Out = (atoi(Buffer) == 1);
			return true;
		}
	}
	/*
	//************************************
	// Method:    LoadInt
	// Profit:	  Loads an int from an ini file
	// FullName:  SD_Tools::AbstractIni::LoadInt
	// Returns:   bool
	// Notes:
	// -returns false upon failure
	//************************************
	bool AbstractIni::LoadInt( char* FilePath, char* Section, char* Name, int* Out )
	{
		char Buffer[256];
		GetPrivateProfileStringA(Section, Name, "ERROR", Buffer, sizeof(Buffer), FilePath);
		if (strcmp(Buffer, "ERROR") == 0)
		{
			return false;
		}
		else
		{
			*Out = atoi(Buffer);
			return true;
		}
	}

	//************************************
	// Method:    LoadHex
	// Profit:	  Loads a Hex from an ini file
	// FullName:  SD_Tools::AbstractIni::LoadHex
	// Returns:   bool
	// Notes:
	// -returns false upon failure
	//************************************
	bool AbstractIni::LoadHex( char* FilePath, char* Section, char* Name, DWORD* Out )
	{
		char Buffer[256];
		GetPrivateProfileStringA(Section, Name, "ERROR", Buffer, sizeof(Buffer), FilePath);
		if (strcmp(Buffer, "ERROR") == 0)
		{
			return false;
		}
		else
		{
			*Out = strtoul(Buffer, NULL, 0);
			return true;
		}
	}

	//************************************
	// Method:    LoadFloat
	// Profit:	  Loads a float from an ini file
	// FullName:  SD_Tools::AbstractIni::LoadFloat
	// Returns:   bool
	// Notes:
	// -returns false upon failure
	//************************************
	bool AbstractIni::LoadFloat( char* FilePath, char* Section, char* Name, float* Out )
	{
		char Buffer[256];
		GetPrivateProfileStringA(Section, Name, "ERROR", Buffer, sizeof(Buffer), FilePath);
		if (strcmp(Buffer, "ERROR") == 0)
		{
			return false;
		}
		else
		{
			*Out = (float) atof(Buffer);
			return true;
		}
	}

	//************************************
	// Method:    LoadString
	// Profit:	  Loads a wide character string from an ini file
	// FullName:  SD_Tools::AbstractIni::LoadString
	// Returns:   bool
	// Notes:
	// -returns false upon failure
	//************************************
	bool AbstractIni::LoadString( char* FilePath, char* Section, char* Name, char* Out )
	{
		char Buffer[256];
		GetPrivateProfileStringA(Section, Name, "ERROR", Buffer, sizeof(Buffer), FilePath);
		if (strcmp(Buffer, "ERROR") == 0)
		{
			return false;
		}
		else
		{
			strcpy(Out, Buffer);
			return true;
		}
	}
	*/
};